package com.yxy.mapper;

import com.github.pagehelper.Page;
import com.yxy.pojo.dto.NewsDTO;
import com.yxy.pojo.dto.NewsPageQueryDTO;
import com.yxy.pojo.entity.News;
import com.yxy.pojo.vo.NewsPageQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface NewsMapper {
    /**
     * 分页查询咨询列表
     * @param newsPageQueryDTO
     * @return
     */
    Page<NewsPageQueryVO> pageQuery(NewsPageQueryDTO newsPageQueryDTO);

    /**
     * 根据标题查询咨询
     * @param title
     * @return
     */
    @Select("select * from news where title = #{title}")
    News selectByTitle(String title);

    /**
     * 添加咨询
     * @param news
     */
    void insert(News news);

    /**
     * 根据id删除咨询
     * @param ids
     */
    void deleteByIds(int[] ids);

    /**
     * 修改咨询
     * @param news
     */
    void update(News news);

    /**
     * 根据id查询咨询
     * @param newId
     * @return
     */
    @Select("select * from news where id = #{newId}")
    News selectById(int newId);
}
